let ss = 0

function sttm() {
    ss = Number(document.getElementById('intm').value) * 60
    pgtoM()
    document.getElementById('tm').style.display = 'block'
    document.getElementById('tm_t').style.color = 'white';
    if (ss == 0) {
        document.getElementById('tm_t').innerHTML = 'Cannot!'
        document.getElementById('tm_t').style.color = 'red';
    }
    else tm()
}

function ad() {
    let intm = document.getElementById('intm')
    intm.value = Number(intm.value) + 15

}

function mi() {
    let intm = document.getElementById('intm')
    if (intm.value === '0') return
    intm.value = Number(intm.value) - 15
}

function tm() {
    let mh = ss % 2 === 0 ? ':' : ' '
    document.getElementById('tm_t').innerHTML =
        pt(Math.floor(ss / 3600)) + mh + pt(Math.floor(ss / 60)) + mh + pt(ss % 60)
    ss--
    if (ss > -1) setTimeout('tm()', 1000)
    else ss = -1
}

function vis() {
    if (ss <= 0) {
        document.getElementById('tm').style.display = 'none'
    }
}
